class Link < ActiveRecord::Base
  belongs_to :user
  validates_presence_of :name
  attr_accessor :image
  before_save :save_image
  protected
  def save_image
    unless @image.blank?
      self.img=CommonFunction.upload_file(@image,"/public/images/newsimgs/")
      CommonFunction.get_thumnb("/public/images/newsimgs/#{self.img}",100,true)
    end
  end
end
